home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / misc1 / iv26_w30.zip / INTERVIE / BOX.H < prev    next >
C/C++ Source or Header  |  1980-01-03  |  4KB  |  116 lines

  1. /*
  2.  * Copyright (c) 1987, 1988, 1989 Stanford University
  3.  *
  4.  * Permission to use, copy, modify, distribute, and sell this software and its
  5.  * documentation for any purpose is hereby granted without fee, provided
  6.  * that the above copyright notice appear in all copies and that both that
  7.  * copyright notice and this permission notice appear in supporting
  8.  * documentation, and that the name of Stanford not be used in advertising or
  9.  * publicity pertaining to distribution of the software without specific,
  10.  * written prior permission.  Stanford makes no representations about
  11.  * the suitability of this software for any purpose.  It is provided "as is"
  12.  * without express or implied warranty.
  13.  *
  14.  * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  15.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
  16.  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  17.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  18.  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  19.  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  20.  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  21.  */
  22.  
  23. /*
  24.  * Boxes are used to compose side-by-side.
  25.  */
  26.  
  27. #ifndef box_h
  28. #define box_h
  29.  
  30. #include <InterViews/scene.h>
  31.  
  32. class BoxElement;
  33. class BoxCanonical;
  34.  
  35. class Box : public Scene {
  36. public:
  37.     void Align(Alignment);
  38.     void Draw();
  39.     void GetComponents(Interactor**, int, Interactor**&, int&);
  40.     void Resize();
  41. protected:
  42.     Alignment align;
  43.  
  44.     Box();
  45.     ~Box();
  46.  
  47.     virtual void ComputeShape(Shape*);
  48.     virtual void GetActual(int& major, int& minor);
  49.     virtual void GetCanonical(Shape*, BoxCanonical&);
  50.     BoxElement* Head();
  51.     virtual void PlaceElement(
  52.     Interactor*, Coord major, int len, int thick, int minor
  53.     );
  54.     virtual void Reconfig();
  55. private:
  56.     int nelements;
  57.     BoxElement* head;
  58.     BoxElement* tail;
  59.  
  60.     void DoInsert(Interactor*, boolean, Coord& x, Coord& y);
  61.     void DoChange(Interactor*);
  62.     void DoRemove(Interactor*);
  63. };
  64.  
  65. class HBox : public Box {
  66. public:
  67.     HBox();
  68.     HBox(Interactor*);
  69.     HBox(Interactor*, Interactor*);
  70.     HBox(Interactor*, Interactor*, Interactor*);
  71.     HBox(Interactor*, Interactor*, Interactor*, Interactor*);
  72.     HBox(Interactor*, Interactor*, Interactor*, Interactor*, Interactor*);
  73.     HBox(
  74.     Interactor*, Interactor*, Interactor*, Interactor*, Interactor*,
  75.     Interactor*
  76.     );
  77.     HBox(
  78.     Interactor*, Interactor*, Interactor*, Interactor*, Interactor*,
  79.     Interactor*, Interactor*
  80.     );
  81. protected:
  82.     void ComputeShape(Shape*);
  83.     void GetActual(int& major, int& minor);
  84.     void GetCanonical(Shape*, BoxCanonical&);
  85.     void PlaceElement(Interactor*, Coord, int, int, int);
  86. private:
  87.     void Init();
  88. };
  89.  
  90. class VBox : public Box {
  91. public:
  92.     VBox();
  93.     VBox(Interactor*);
  94.     VBox(Interactor*, Interactor*);
  95.     VBox(Interactor*, Interactor*, Interactor*);
  96.     VBox(Interactor*, Interactor*, Interactor*, Interactor*);
  97.     VBox(Interactor*, Interactor*, Interactor*, Interactor*, Interactor*);
  98.     VBox(
  99.     Interactor*, Interactor*, Interactor*, Interactor*, Interactor*,
  100.     Interactor*
  101.     );
  102.     VBox(
  103.     Interactor*, Interactor*, Interactor*, Interactor*, Interactor*,
  104.     Interactor*, Interactor*
  105.     );
  106. protected:
  107.     void ComputeShape(Shape*);
  108.     void GetActual(int& major, int& minor);
  109.     void GetCanonical(Shape*, BoxCanonical&);
  110.     void PlaceElement(Interactor*, Coord, int, int, int);
  111. private:
  112.     void Init();
  113. };
  114.  
  115. #endif
  116.